package com.zl.learning.arithmetic.my;

import java.util.HashMap;
import java.util.Map;

public enum DataType {
    /**
     * 推送设备类型 1 人脸 2imsi 3 mac 4机动车 5非机动车 6 人体
     */
    FACE(1, "face"),
    IMSI(2, "imsi"),
    MAC(3, "mac"),
    VEHICLE(4, "vehicle"),
    BODY(6, "body");

    public int type;
    public String name;

    DataType(int type, String name) {
        this.type = type;
        this.name = name;
    }

    private static final Map<Integer, DataType> DATA_TYPE_MAP = new HashMap<>();

    static {
        for (DataType value : DataType.values()) {
            DATA_TYPE_MAP.put(value.type, value);
        }
    }

    public static DataType getByType(Integer type) {
        return DATA_TYPE_MAP.get(type);
    }
}
